/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.AccountServiceException;
/*    */ import com.zimbra.cs.account.Group;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class DistributionListDocumentHandler
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   private static final String GROUP = "__GROUP__";
/*    */   
/*    */   protected abstract Group getGroup(Element paramElement)
/*    */     throws ServiceException;
/*    */   
/*    */   protected final Group getGroupAndCacheInContext(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 37 */     Group group = getGroup(request);
/* 38 */     if (group != null) {
/* 39 */       context.put("__GROUP__", group);
/*    */     }
/* 41 */     return group;
/*    */   }
/*    */   
/*    */   protected Group getGroupFromContext(Map<String, Object> context) throws ServiceException {
/* 45 */     return (Group)context.get("__GROUP__");
/*    */   }
/*    */   
/*    */ 
/*    */   protected Element proxyIfNecessary(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 52 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 53 */     if (zsc.getProxyTarget() != null) {
/* 54 */       return null;
/*    */     }
/*    */     
/*    */     try
/*    */     {
/* 59 */       Group group = getGroupAndCacheInContext(request, context);
/*    */       
/* 61 */       if ((group != null) && (!Provisioning.onLocalServer(group))) {
/* 62 */         Server server = group.getServer();
/* 63 */         if (server == null) {
/* 64 */           throw ServiceException.PROXY_ERROR(AccountServiceException.NO_SUCH_SERVER(group.getAttr("zimbraMailHost")), "");
/*    */         }
/*    */         
/*    */ 
/* 68 */         return proxyRequest(request, context, server);
/*    */       }
/*    */       
/* 71 */       return super.proxyIfNecessary(request, context);
/*    */     }
/*    */     catch (ServiceException e) {
/* 74 */       if ("service.PROXY_ERROR".equals(e.getCode())) {
/* 75 */         return null;
/*    */       }
/*    */       
/* 78 */       throw e;
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/DistributionListDocumentHandler.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */